# -*- encoding: utf-8 -*-
"""
@File    : 01正则常用表达式.py
@Time    : 2020/11/9 10:02
@Author  : lluyao
@Email   : lluyao61@163.com
@Software: PyCharm
"""

import re

# msg = 'san chuang tong le, huan ying ni "hello world", learning python'
# msg2 = '123@qq.comaaa@126.combbb@163.comcc@abc.com'
# msg3 = '<html>test1<div>test2</div><a>test3</a><html>'
# msg_result = re.findall(r'[A-Za-z]+',msg)
# msg2_result = re.findall('(?:\.com)?(\w+@(?:qq|163|126).com)',msg2)
# msg3_result = re.findall(r'<(\w+)>(\w+)<(/\1)>',msg3)
# print(msg_result)
# print(msg2_result)
# print(msg3_result)

# ret = re.findall('(?i)^python$','Python')
# print(ret)
# ret = re.findall('(?i)^python$','Python\npython')
# print(ret)
# ret = re.findall('(?im)^python$','Python\npython')
# print(ret)
#
# msg = 'Hello Python'
# ret = re.findall('(?i:hello) python',msg)
# print(ret)
# ret = re.findall('(?i:hello) Python',msg)
# print(ret)

msg = '''
https://music.163.com/#/discover/toplist
http://www.baidu.com?a=1
http://news.xinlang.cn
htp://xinlang.cn

'''
print(re.findall(r'(?im:http://|https://)((?:[a-z]+\.)?\w+\.(?:com|cn))',msg))
print(re.findall(r'(?im:http://|https://)(?:[a-z]+\.)?\w+\.(?:com|cn)',msg))

user_email = input('please input your email:')
if re.findall(r'\w{6,18}@[A-z0-9\-]+\.com',user_email) :
    print('邮箱符合要求')
else:
    print('邮箱不符合要求')